﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace mobliebo
{
public  class invoice
    {
    iDAC DAC = DACFactory.GetDAC();
    private long _customer_id = -99;
    private long _invoice_id = -99;
    private  string _invoice_date="1/1/1800";
    private long _total_amount=-99;
    private long _tax=-99;
    private long _advance_amount=-99;
    private string _is_paid="";
    private string _pay_method="";
    private bool _is_deleted=false;
    public bool is_deleted
    {
        get
        {
            return  _is_deleted;
        }
        set
        {
            _is_deleted=value;
        }
    }public long customer_id
    {
        get
        {
            return  _customer_id;
        }
        set
        {
            _customer_id=value;
        }
    }public long invoice_id
    {
        get
        {
            return  _invoice_id;
        }
        set
        {
           _invoice_id=value;
        }
    }public string invoice_date
    {
        get
        {
            return _invoice_date;
        }
        set
        {
           _invoice_date=value;
        }
    }public long total_amount
    {
        get
        {
            return  _total_amount;
        }
        set
        {
            _total_amount=value;
        }
    }public long tax
    {
        get
        {
            return  _tax;
        }
        set
        {
            _tax=value;
        }
    }public long advance_amount
    {
        get
        {
            return  _advance_amount;
        }
        set
        {
            _advance_amount=value;
        }
    }public string is_paid
    {
        get
        {
            return  _is_paid;
        }
        set
        {
            _is_paid=value;
        }
    }public string pay_method
    {
        get
        {
            return  _pay_method;
        }
        set
        {
            _pay_method=value;
        }
    }

    public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0=DAC.Parameter("@customer_id",customer_id,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam1=DAC.Parameter("@invoice_id",invoice_id,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam2=DAC.Parameter("@invoice_date",invoice_date,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam3=DAC.Parameter("@total_amount",total_amount,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam4=DAC.Parameter("@tax",tax,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam5=DAC.Parameter("@advance_amount",advance_amount,DbType.Int64,ParameterDirection.Input);
                 DbParameter dbparam6=DAC.Parameter("@is_deleted",is_deleted,DbType.Boolean,ParameterDirection.Input);
                DbParameter dbparam7=DAC.Parameter("@is_paid",is_paid,DbType.AnsiString,ParameterDirection.Input);
                 DbParameter dbparam8=DAC.Parameter("@pay_method",pay_method,DbType.AnsiString,ParameterDirection.Input);
                 DbParameter[] dbparamcall=new DbParameter[]{dbparam0, dbparam1,dbparam2, dbparam3, dbparam4,dbparam5,dbparam6,dbparam7,dbparam8};
                return DAC.Save("invoice_save",dbparamcall);
            }
            catch(Exception ex)
            {
                long result=-99;
            }
            return-99;
        } public DataTable GetRecords(long customer_id,long invoice_id,string invoice_date,long total_amount,long tax, long advance_amount,bool is_deleted,string is_paid,string pay_method,string andor)
        {
            try
            {
                DbParameter dbparam0=DAC.Parameter("@customer_id",customer_id,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam1=DAC.Parameter("@invoice_id",invoice_id,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam2=DAC.Parameter("@invoice_date",invoice_date,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam3=DAC.Parameter("@total_amount",total_amount,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam4=DAC.Parameter("@tax",tax,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam5=DAC.Parameter("@advance_amount",advance_amount,DbType.Int64,ParameterDirection.Input);
                 DbParameter dbparam6=DAC.Parameter("@is_deleted",is_deleted,DbType.Boolean,ParameterDirection.Input);
                DbParameter dbparam7=DAC.Parameter("@is_paid",is_paid,DbType.AnsiString,ParameterDirection.Input);
                 DbParameter dbparam8=DAC.Parameter("@pay_method",pay_method,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam9=DAC.Parameter("@andor",andor,DbType.AnsiString,ParameterDirection.Input);
                 DbParameter[] dbparamcall=new DbParameter[]{dbparam0, dbparam1,dbparam2, dbparam3, dbparam4,dbparam5,dbparam6,dbparam7,dbparam8,dbparam9};
                return DAC.Select("invoice_get",dbparamcall);
                DataTable dt1=DAC.Select("invoice_get",dbparamcall);
                return dt1;
            }
            catch(Exception ex)
            {
                long result=-99;
            }
            return null;
                
    }
    

}
}
